#pragma once

#include<string>
#include<vector>
#include<map>

#include"db_table.h"

namespace uhdpbs {
	namespace db {
		class connection;
		class table;

		typedef std::map<std::string, std::string> string_string_map;
		typedef std::pair<std::string, std::string> string_string_pair;
		typedef string_string_map::iterator string_string_iterator;

		class row {
			friend class connection;

		protected:
			table* ptblContainer;
			bool bIsDeleted;
			string_string_map mOriginals;
			string_string_map mChanges;

		public:
			row(string_string_map originals, table* tbl);
			~row();

			table* get_table();

			std::string get_id();
			void set_id(std::string val);

			std::string get_value(std::string col);
			void set_value(std::string col, std::string val);

			string_string_map get_originals();
			string_string_map get_changes();

			bool is_deleted();
			void is_deleted(bool val);

			bool is_new();

			void reset();
			std::string trim(std::string orig);
		};
	}
}